package java_DesignPattern.CreatorPattern.FactoryPattern.AbstractFactory;

/**
 * 咖啡商店类
 */
public class CoffeeShop {

    //set注入
    private TianPianFactory tianPianFactory;

    public void setTianPianFactory(TianPianFactory tianPianFactory) {
        this.tianPianFactory = tianPianFactory;
    }

    /**
     * 订单方法
     */
    public void order(){
        // 咖啡商店根据工厂创建咖啡和甜品类
        Coffe coffe = tianPianFactory.createCoffe();
        TianPin tianPin = tianPianFactory.createTianPin();

        // 咖啡商店添加咖啡和甜品类
        coffe.addMilk();
        coffe.addSugar();

        // 咖啡商店打印订单
        System.out.println("咖啡商店订单:");
        System.out.println(coffe.getName());
        tianPin.show();
    }
}
